package com.markus.code.图.图1;

import java.util.List;

/**
 * Author:markusZhang
 * Date:Create in 2020/8/18 21:35
 * todo:
 */
public class TestDemo {
    public static void main(String[] args) {
//        int [][] flights = {{100,1,2},{100,1,3},{500,1,4},{500,2,3},{500,2,5},{500,3,4}};
        int [][] flights = {{100,1,2},{100,2,3},{500,3,4},{500,1,3},{500,2,4}};
        Graph graph = GraphGenerator.createGraph(flights);
//        System.out.println("深度优先遍历：");
//        GraphDfs dfs = new GraphDfs();
//        dfs.dfs(graph.nodes.get(1));
//        System.out.println();
//        System.out.println("广度优先遍历：");
//        GraphBfs bfs = new GraphBfs();
//        bfs.bfs(graph.nodes.get(1));
//        System.out.println();
        System.out.println("拓扑排序：");
        GraphTopologySort topologySort = new GraphTopologySort();
        List<Node> nodes = topologySort.topology(graph);
        for (Node node : nodes) {
            System.out.print(node.value+" ");
        }
//        System.out.println(graph);
    }
}
